import { TypeOrmModule } from '@nestjs/typeorm';
import config from '../app.config';

export const ormModule = TypeOrmModule.forRoot({
  type: 'mssql',
  host: config.DB.HOST ? config.DB.HOST : '192.168.1.240',
  port: config.DB.PORT ? Number(config.DB.PORT) : 1433,
  username: config.DB.USERNAME ? config.DB.USERNAME : 'sa',
  password: config.DB.PASSWORD ? config.DB.PASSWORD : 'THth@2023',
  database: config.DB.DATABASE ? config.DB.DATABASE : 'riverbed',
  entities: [__dirname + '/**/*.entity{.ts,.js}'],
  extra: { trustServerCertificate: true },
  autoLoadEntities: true, // 自动加载实体
  logging: [], // 不启用日志记录
});
